﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ShareMarking.Service;
using ShareMarking.Entity;
using ShareMarking.Interface;
using System.Data;
using MySoft.Data;
using System.Configuration;

namespace ShareMarking.Check
{
    class Program
    {
        static void Main(string[] args)
        {
             //CheckNC();        //请求检验接口004检查NC
            CheckHospital();//请求检验接口004检查医院
            //CheckPNR();    //请求检验接口004检查PNR
            //CheckStore();//请求检验接口004检查门店
        }

        private static string vigohttp = ConfigurationManager.AppSettings["vigohttp"];
        private static string signscrect = ConfigurationManager.AppSettings["signscrect"];
        private static void CheckNC()
        {
            ComLib.LogLib.Log4NetBase.Log("1.---------------开始检查NC！---------------");

            #region 初始化变量
            string scene_id = "";
            var addcount = 0;//成功条数
            int errorCount = 0;//失败条数
            #endregion

            try
            {
                #region 初始化数据
                DbSession.Default.FromSql("DELETE qr_check where qrtype=1").Execute();

               //DataTable table = new DataTable();
//               string sql = @"SELECT nc.nc_code,qr.scene_id,qr.qrcode_url,qr.code_url
//               from nc_ncuser nc left join qr_QrCodeRelate rel on nc.nc_code=rel.rel_Code 
//               left join qr_QrCode qr on rel.qr_Scene_ID=qr.scene_id where rel.IsDelete=0 and nc.nc_code IN ('100013',
//'203528',
//'80027',
//'1100131',
//'1300225',
//'100735',
//'100768',
//'100345',
//'540033',
//'301936')"; //,19120,19119,19118,19117,19116,19115,19114,19113
                DataTable table = new DataTable();
                string sql = @"SELECT nc.nc_code,qr.scene_id,qr.qrcode_url,qr.code_url from nc_ncuser nc left join qr_QrCodeRelate rel on nc.nc_code=rel.rel_Code 
                               left join qr_QrCode qr on rel.qr_Scene_ID=qr.scene_id where rel.IsDelete=0 and rel.qr_Type=1";                
                table = DbSession.Default.FromSql(sql).ToTable();
                table.TableName = "checktb";

                CheckQrcode check = new CheckQrcode();
                //Qrcode_vigo vigo = new Qrcode_vigo("http://my.erpcoo.com/index.php/Api/Qrcode/index", "sdf5sf5et5e42t5");
                Qrcode_vigo vigo = new Qrcode_vigo(vigohttp, signscrect);
                #endregion

                ComLib.LogLib.Log4NetBase.Log("2.---------------总共：" + table.Rows.Count + "条数据---------------");

                #region 循环遍历对比数据，保存到本地
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    scene_id = "nc_code:" + table.Rows[i]["nc_code"].ToString() + "//scene_id:" + table.Rows[i]["scene_id"].ToString() + "//qrcode_url:" + table.Rows[i]["qrcode_url"].ToString();
                    ComLib.LogLib.Log4NetBase.Log("---------------正在执行第：" + i + "条数据---------------");
                  
                    #region 逻辑对比数据（对比图文信息）
                    var imgurl = table.Rows[i]["qrcode_url"].ToString();
                    var qrcodecontent = check.getqrcontent(imgurl);
                    var resultwx = vigo.GetWXContent("", table.Rows[i]["scene_id"].ToString());

                    var vigomessage1 = "title:" + resultwx.message[0].title
                            + "desc:" + resultwx.message[0].shortdesc
                            + "pic:" + resultwx.message[0].picurl
                            + "link:" + resultwx.message[0].linkurl;
                    var message1 = "title:马上加入美赞臣A＋妈妈会，尊享360°孕育礼遇"
                            + "desc:一键注册，终身礼遇"
                            + "pic:http://admin.mjn.howjoin.com/images/p1.jpg"
                            + "link:" + "http://crmweb.meadjohnson.com.cn/mjnwx/client_phone.action?regSubChannel=188$NCCode=" 
                                + table.Rows[i]["nc_code"].ToString() + "$openId=####";
                    var vigomessage2 = "title:" + resultwx.message[1].title
                            + "desc:" + resultwx.message[1].shortdesc
                            + "pic:" + resultwx.message[1].picurl
                            + "link:" + resultwx.message[1].linkurl;
                    var message2 = "title:不可错过的海量专业孕育课程＆胎教早教资源！"
                            + "desc:有声资源每周更新，满足妈妈＆宝宝共同需求"
                            + "pic:http://admin.mjn.howjoin.com/images/p2.jpg"
                            + "link:" + "http://mp.weixin.qq.com/s?__biz=MjM5MjM1NjMzNA==$mid=2656105052$idx=2$sn=0d2328393e16964b17e11e30bb85378f$scene=1$srcid=06209qW7BXxURv3bBLvzMGHZ";
                    var vigomessage3 = "title:" + resultwx.message[2].title
                            + "desc:" + resultwx.message[2].shortdesc
                            + "pic:" + resultwx.message[2].picurl
                            + "link:" + resultwx.message[2].linkurl;
                    var message3 = "title:【会员福利】奶粉、京东优惠券、巧虎礼包、滴滴红包等你拿,还有……"
                            + "desc:惊喜连连，准备好了么？"
                            + "pic:http://admin.mjn.howjoin.com/images/p3.jpg"
                            + "link:" + "http://mp.weixin.qq.com/s?__biz=MjM5MjM1NjMzNA==$mid=2656105052$idx=3$sn=8478a978359403d68c1452f132455d32$scene=1$srcid=0620AZL0kIEOrjKTGX6Y2emW";
                    #endregion

                    #region 保存对比结果进库
                    qr_Check qrc = new qr_Check()
                    {
                        qrtype = "1",
                        rel_code = table.Rows[i]["nc_code"].ToString(),
                        scene_id = table.Rows[i]["scene_id"].ToString(),

                        code_url = table.Rows[i]["code_url"].ToString(),
                        httpcode_url = qrcodecontent,
                        iseqccode_url = (table.Rows[i]["code_url"].ToString() == qrcodecontent),

                        message1 = message1,
                        vigomessage1 = vigomessage1,
                        iseq1 = (message1 == vigomessage1),

                        message2 = message2,
                        vigomessage2 = vigomessage2,
                        iseq2 = (message2 == vigomessage2),

                        message3 = message3,
                        vigomessage3 = vigomessage3,
                        iseq3 = (message3 == vigomessage3)
                    };
                    bool result = qr_CheckService.Instance.Add_Entity(qrc);                    
                    if (result == true)
                    {
                        addcount += 1;
                        //ComLib.LogLib.Log4NetBase.Log("插入成功::" + scene_id);
                    }
                    else
                    {
                        errorCount += 1;
                        ComLib.LogLib.Log4NetBase.Log("插入失败::" + scene_id);
                    }
                    #endregion
                }
                #endregion

                ComLib.LogLib.Log4NetBase.Log("3.---------------检查NC结束！成功" + addcount + "条；失败" + errorCount + "条---------------");
            }
            catch (Exception ex)
            {
                ComLib.LogLib.Log4NetBase.Log("检查NC错误:" + ex.Message + scene_id);
            }
        }

        private static void CheckHospital()
        {
            ComLib.LogLib.Log4NetBase.Log("1.---------------开始检查Hospital！");

            #region 初始化变量
            string scene_id = "";
            var addcount = 0;//成功条数
            int errorCount = 0;//失败条数
            #endregion

            try
            {
                #region 初始化数据
                DbSession.Default.FromSql("DELETE qr_check where qrtype=2").Execute();

                DataTable table = new DataTable();
                string sql = @"SELECT hp.code__c,hp.msr_staffid__c,hp.Active__c,qr.scene_id,qr.qrcode_url,qr.code_url,qr.wx_title,qr.wx_content,qr.wx_imgurl,qr.wx_url
                            from sfdc_hospital hp left join qr_QrCodeRelate rel on hp.code__c=rel.rel_Code 
                            left join qr_QrCode qr on rel.qr_Scene_ID=qr.scene_id where rel.IsDelete=0";

                table = DbSession.Default.FromSql(sql).ToTable();
                table.TableName = "checktb";

                CheckQrcode check = new CheckQrcode();
                //Qrcode_vigo vigo = new Qrcode_vigo("http://my.erpcoo.com/index.php/Api/Qrcode/index", "sdf5sf5et5e42t5");
                Qrcode_vigo vigo = new Qrcode_vigo(vigohttp, signscrect);
                #endregion

                ComLib.LogLib.Log4NetBase.Log("2.---------------总共：" + table.Rows.Count + "条数据---------------");

                #region 循环遍历对比数据，保存到本地
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    scene_id = "医院PNRCode:" + table.Rows[i]["msr_staffid__c"].ToString()+"//scene_id:" + table.Rows[i]["scene_id"].ToString() + "//qrcode_url:" + table.Rows[i]["qrcode_url"].ToString();
                    ComLib.LogLib.Log4NetBase.Log("---------------正在执行第：" + i + "条数据---------------");

                    #region 逻辑对比数据（对比图文信息）
                    var imgurl = table.Rows[i]["qrcode_url"].ToString();
                    var qrcodecontent = check.getqrcontent(imgurl);
                    var resultwx = vigo.GetWXContent("", table.Rows[i]["scene_id"].ToString());

                    string picandlink;
                    if (table.Rows[i]["Active__c"].ToString().ConvertTo<bool>() == true)
                    {
                        picandlink = "pic:http://admin.mjn.howjoin.com/images/p1.jpg"
                            + "link:" + string.Format("http://crmweb.meadjohnson.com.cn/mjnwx/client_phone.action?regSubChannel=174$NCCode={0}$PNRCode={1}$openId=####",
                            table.Rows[i]["code__c"].ToString(), table.Rows[i]["msr_staffid__c"].ToString());
                    }
                    else
                    {
                        picandlink = "pic:http://admin.mjn.howjoin.com/images/p1.jpg"
                            + "link:http://crmweb.meadjohnson.com.cn/mjnwx/client_phone.action?regSubChannel=174$openId=####";
                    }

                    var vigomessage1 = "title:" + resultwx.message[0].title
                            + "desc:" + resultwx.message[0].shortdesc
                            + "pic:" + resultwx.message[0].picurl
                            + "link:" + resultwx.message[0].linkurl;
                    var message1 = "title:马上加入美赞臣A＋妈妈会，尊享360°孕育礼遇"
                            + "desc:一键注册，终身礼遇" + picandlink;
                            
                    var vigomessage2 = "title:" + resultwx.message[1].title
                            + "desc:" + resultwx.message[1].shortdesc
                            + "pic:" + resultwx.message[1].picurl
                            + "link:" + resultwx.message[1].linkurl;
                    var message2 = "title:不可错过的海量专业孕育课程＆胎教早教资源！"
                            + "desc:有声资源每周更新，满足妈妈＆宝宝共同需求"
                            + "pic:http://admin.mjn.howjoin.com/images/p2.jpg"
                            + "link:" + "http://mp.weixin.qq.com/s?__biz=MjM5MjM1NjMzNA==$mid=2656105052$idx=2$sn=0d2328393e16964b17e11e30bb85378f$scene=1$srcid=06209qW7BXxURv3bBLvzMGHZ";
                    var vigomessage3 = "title:" + resultwx.message[2].title
                            + "desc:" + resultwx.message[2].shortdesc
                            + "pic:" + resultwx.message[2].picurl
                            + "link:" + resultwx.message[2].linkurl;
                    var message3 = "title:【会员福利】奶粉、京东优惠券、巧虎礼包、滴滴红包等你拿,还有……"
                            + "desc:惊喜连连，准备好了么？"
                            + "pic:http://admin.mjn.howjoin.com/images/p3.jpg"
                            + "link:" + "http://mp.weixin.qq.com/s?__biz=MjM5MjM1NjMzNA==$mid=2656105052$idx=3$sn=8478a978359403d68c1452f132455d32$scene=1$srcid=0620AZL0kIEOrjKTGX6Y2emW";
                    #endregion

                    #region 保存对比结果进库
                    qr_Check qrc = new qr_Check()
                    {
                        qrtype = "2",
                        rel_code = table.Rows[i]["code__c"].ToString(),
                        scene_id = table.Rows[i]["scene_id"].ToString(),

                        code_url = table.Rows[i]["code_url"].ToString(),
                        httpcode_url = qrcodecontent,
                        iseqccode_url = (table.Rows[i]["code_url"].ToString() == qrcodecontent),

                        message1 = message1,
                        vigomessage1 = vigomessage1,
                        iseq1 = (message1 == vigomessage1),

                        message2 = message2,
                        vigomessage2 = vigomessage2,
                        iseq2 = (message2 == vigomessage2),

                        message3 = message3,
                        vigomessage3 = vigomessage3,
                        iseq3 = (message3 == vigomessage3)

                    };
                    bool result = qr_CheckService.Instance.Add_Entity(qrc);
                    if (result == true)
                    {
                        addcount += 1;
                        //ComLib.LogLib.Log4NetBase.Log("插入成功::" + scene_id);
                    }
                    else
                    {
                        errorCount += 1;
                        ComLib.LogLib.Log4NetBase.Log("插入失败::" + scene_id);
                    }

                    #endregion
                }
                #endregion

                ComLib.LogLib.Log4NetBase.Log("3.---------------检查HOSP结束！成功" + addcount + "条；失败" + errorCount + "条---------------");
            }
            catch (Exception ex)
            {
                ComLib.LogLib.Log4NetBase.Log("检查HOSP错误:" + ex.Message + scene_id);
            }
        }

        private static void CheckPNR()
        {
            ComLib.LogLib.Log4NetBase.Log("1.---------------开始检查PNR！---------------");

            #region 初始化变量
            string scene_id = "";
            var addcount = 0;//成功条数
            int errorCount = 0;//失败条数
            #endregion
            try
            {
                #region 初始化数据
                DbSession.Default.FromSql("DELETE qr_check where qrtype=3").Execute();

                DataTable table = new DataTable();
                string sql = @"SELECT pnr.employeenumber__c,pnr.IsActive__c,qr.scene_id,qr.qrcode_url,qr.code_url,qr.wx_title,qr.wx_content,qr.wx_imgurl,qr.wx_url
                            from sfdc_pnr pnr left join qr_QrCodeRelate rel on pnr.employeenumber__c=rel.rel_Code 
                            left join qr_QrCode qr on rel.qr_Scene_ID=qr.scene_id where rel.IsDelete=0";

                table = DbSession.Default.FromSql(sql).ToTable();
                table.TableName = "checktb";

                CheckQrcode check = new CheckQrcode();
                //Qrcode_vigo vigo = new Qrcode_vigo("http://my.erpcoo.com/index.php/Api/Qrcode/index", "sdf5sf5et5e42t5");
                Qrcode_vigo vigo = new Qrcode_vigo(vigohttp, signscrect);
                #endregion

                ComLib.LogLib.Log4NetBase.Log("2.---------------总共：" + table.Rows.Count + "条数据---------------");

                #region 循环遍历对比数据，保存到本地
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    scene_id = "PNRCode:" + table.Rows[i]["employeenumber__c"].ToString() + "//scene_id:" + table.Rows[i]["scene_id"].ToString() + "//qrcode_url:" + table.Rows[i]["qrcode_url"].ToString();
                    ComLib.LogLib.Log4NetBase.Log("---------------正在执行第：" + i + "条数据---------------");

                    #region 逻辑对比数据（对比图文信息）
                    var imgurl = table.Rows[i]["qrcode_url"].ToString();
                    var qrcodecontent = check.getqrcontent(imgurl);
                    var resultwx = vigo.GetWXContent("", table.Rows[i]["scene_id"].ToString());

                    string link;
                    if (table.Rows[i]["IsActive__c"].ToString().ConvertTo<bool>() == true)
                    {
                        link = "http://crmweb.meadjohnson.com.cn/mjnwx/client_phone.action?regSubChannel=174$PNRCode="
                            + table.Rows[i]["employeenumber__c"].ToString() + "$openId=####";
                    }
                    else
                    {
                        link = "http://crmweb.meadjohnson.com.cn/mjnwx/client_phone.action?openId=####";
                    }

                    var vigomessage1 = "title:" + resultwx.message[0].title
                            + "desc:" + resultwx.message[0].shortdesc
                            + "pic:" + resultwx.message[0].picurl
                            + "link:" + resultwx.message[0].linkurl;
                    var message1 = "title:马上加入美赞臣A＋妈妈会，尊享360°孕育礼遇"
                            + "desc:一键注册，终身礼遇"
                            + "pic:http://admin.mjn.howjoin.com/images/p1.jpg"
                            + "link:" + link;
                    var vigomessage2 = "title:" + resultwx.message[1].title
                            + "desc:" + resultwx.message[1].shortdesc
                            + "pic:" + resultwx.message[1].picurl
                            + "link:" + resultwx.message[1].linkurl;
                    var message2 = "title:不可错过的海量专业孕育课程＆胎教早教资源！"
                            + "desc:有声资源每周更新，满足妈妈＆宝宝共同需求"
                            + "pic:http://admin.mjn.howjoin.com/images/p2.jpg"
                            + "link:" + "http://mp.weixin.qq.com/s?__biz=MjM5MjM1NjMzNA==$mid=2656105052$idx=2$sn=0d2328393e16964b17e11e30bb85378f$scene=1$srcid=06209qW7BXxURv3bBLvzMGHZ";
                    var vigomessage3 = "title:" + resultwx.message[2].title
                            + "desc:" + resultwx.message[2].shortdesc
                            + "pic:" + resultwx.message[2].picurl
                            + "link:" + resultwx.message[2].linkurl;
                    var message3 = "title:【会员福利】奶粉、京东优惠券、巧虎礼包、滴滴红包等你拿,还有……"
                            + "desc:惊喜连连，准备好了么？"
                            + "pic:http://admin.mjn.howjoin.com/images/p3.jpg"
                            + "link:" + "http://mp.weixin.qq.com/s?__biz=MjM5MjM1NjMzNA==$mid=2656105052$idx=3$sn=8478a978359403d68c1452f132455d32$scene=1$srcid=0620AZL0kIEOrjKTGX6Y2emW";
                      #endregion

                    #region 保存对比结果进库
                    qr_Check qrc = new qr_Check()
                    {
                        qrtype = "3",
                        rel_code = table.Rows[i]["employeenumber__c"].ToString(),
                        scene_id = table.Rows[i]["scene_id"].ToString(),

                        code_url = table.Rows[i]["code_url"].ToString(),
                        httpcode_url = qrcodecontent,
                        iseqccode_url = (table.Rows[i]["code_url"].ToString() == qrcodecontent),

                        message1 = message1,
                        vigomessage1 = vigomessage1,
                        iseq1 = (message1 == vigomessage1),

                        message2 = message2,
                        vigomessage2 = vigomessage2,
                        iseq2 = (message2 == vigomessage2),

                        message3 = message3,
                        vigomessage3 = vigomessage3,
                        iseq3 = (message3 == vigomessage3)
                    };
                    bool result = qr_CheckService.Instance.Add_Entity(qrc);
                    if (result == true)
                    {
                        addcount += 1;
                        //ComLib.LogLib.Log4NetBase.Log("插入成功::" + scene_id);
                    }
                    else
                    {
                        errorCount += 1;
                        ComLib.LogLib.Log4NetBase.Log("插入失败::" + scene_id);
                    }
                     #endregion
                }
                #endregion

                ComLib.LogLib.Log4NetBase.Log("3.---------------检查PNR结束！成功" + addcount + "条；失败" + errorCount + "条---------------");
            }
            catch (Exception ex)
            {
                ComLib.LogLib.Log4NetBase.Log("检查PNR错误:" + ex.Message + scene_id);
            }
        }

        private static void CheckStore()
        {
            ComLib.LogLib.Log4NetBase.Log("1.---------------开始检查Store！---------------");

            #region 初始化变量
            string scene_id = "";
            var addcount = 0;//成功条数
            int errorCount = 0;//失败条数
            #endregion

            try
            {
                #region 初始化数据
                DbSession.Default.FromSql("DELETE qr_check where qrtype=1002").Execute();

                DataTable table = new DataTable();
                string sql = @"SELECT st.storecode,qr.scene_id,qr.qrcode_url,qr.code_url,qr.wx_title,qr.wx_content,qr.wx_imgurl,qr.wx_url
                from qr_Store st left join qr_QrCodeRelate rel on st.storecode=rel.rel_Code 
                left join qr_QrCode qr on rel.qr_Scene_ID=qr.scene_id where rel.IsDelete=0";//AND st.createon>CONVERT(datetime,'2016-05-12 00:00:00')

                table = DbSession.Default.FromSql(sql).ToTable();
                table.TableName = "checktb";

                CheckQrcode check = new CheckQrcode();
                //Qrcode_vigo vigo = new Qrcode_vigo("http://my.erpcoo.com/index.php/Api/Qrcode/index", "sdf5sf5et5e42t5");
                Qrcode_vigo vigo = new Qrcode_vigo(vigohttp, signscrect);
                #endregion

                ComLib.LogLib.Log4NetBase.Log("2.---------------总共：" + table.Rows.Count + "条数据---------------");

                #region 循环遍历对比数据，保存到本地
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    scene_id = "门店storecode:" + table.Rows[i]["storecode"].ToString() + "//scene_id:" + table.Rows[i]["scene_id"].ToString() + "//qrcode_url:" + table.Rows[i]["qrcode_url"].ToString();
                    ComLib.LogLib.Log4NetBase.Log("---------------正在执行第：" + i + "条数据---------------");
                  
                    #region 逻辑对比数据（对比图文信息）
                    var imgurl = table.Rows[i]["qrcode_url"].ToString();
                    var qrcodecontent = check.getqrcontent(imgurl);
                    var resultwx = vigo.GetWXContent("", table.Rows[i]["scene_id"].ToString());


                    var vigomessage1 = "title:" + resultwx.message[0].title
                            + "desc:" + resultwx.message[0].shortdesc
                            + "pic:" + resultwx.message[0].picurl
                            + "link:" + resultwx.message[0].linkurl;
                    var message1 = "title:美赞臣蓝臻，突破性贴近宝宝需求，新妈买一赠一限量臻享"
                               + "desc:"
                               + "pic:http://qrcode.mjn.howjoin.com/imgforweixin/activity.jpg"
                               + "link:" + "http://wx.ismartgo.com/app/lighthouse/index.aspx?from="
                               + table.Rows[i]["storecode"].ToString() + "$type=2$openid=####";
                    #region 弃用多图文
                    //var message1 = "title:马上加入美赞臣A＋妈妈会，尊享360°孕育礼遇"
                    //        + "desc:一键注册，终身礼遇"
                    //        + "pic:http://admin.mjn.howjoin.com/images/p1.jpg"
                    //        + "link:" + "http://wx.ismartgo.com/app/lighthouse/index.aspx?from="
                    //        + table.Rows[i]["storecode"].ToString() + "$type=2$openid=####";
                    //var vigomessage2 = "title:" + resultwx.message[1].title
                    //        + "desc:" + resultwx.message[1].shortdesc
                    //        + "pic:" + resultwx.message[1].picurl
                    //        + "link:" + resultwx.message[1].linkurl;
                    //var message2 = "title:不可错过的海量专业孕育课程＆胎教早教资源！"
                    //        + "desc:有声资源每周更新，满足妈妈＆宝宝共同需求"
                    //        + "pic:http://admin.mjn.howjoin.com/images/p2.jpg"
                    //        + "link:" + "http://mp.weixin.qq.com/s?__biz=MjM5MjM1NjMzNA==$mid=2656105052$idx=2$sn=0d2328393e16964b17e11e30bb85378f$scene=1$srcid=06209qW7BXxURv3bBLvzMGHZ";
                    //var vigomessage3 = "title:" + resultwx.message[2].title
                    //        + "desc:" + resultwx.message[2].shortdesc
                    //        + "pic:" + resultwx.message[2].picurl
                    //        + "link:" + resultwx.message[2].linkurl;
                    //var message3 = "title:【会员福利】奶粉、京东优惠券、巧虎礼包、滴滴红包等你拿,还有……"
                    //        + "desc:惊喜连连，准备好了么？"
                    //        + "pic:http://admin.mjn.howjoin.com/images/p3.jpg"
                    //        + "link:" + "http://mp.weixin.qq.com/s?__biz=MjM5MjM1NjMzNA==$mid=2656105052$idx=3$sn=8478a978359403d68c1452f132455d32$scene=1$srcid=0620AZL0kIEOrjKTGX6Y2emW";
                    #endregion
                    #endregion

                    #region 保存对比结果进库
                    qr_Check qrc = new qr_Check()
                    {
                        qrtype = "1002",
                        rel_code = table.Rows[i]["storecode"].ToString(),
                        scene_id = table.Rows[i]["scene_id"].ToString(),

                        code_url = table.Rows[i]["code_url"].ToString(),
                        httpcode_url = qrcodecontent,
                        iseqccode_url = (table.Rows[i]["code_url"].ToString() == qrcodecontent),

                        message1 = message1,
                        vigomessage1 = vigomessage1,
                        iseq1 = (message1 == vigomessage1),

                        //message2 = message2,
                        //vigomessage2 = vigomessage2,
                        //iseq2 = (message2 == vigomessage2),

                        //message3 = message3,
                        //vigomessage3 = vigomessage3,
                        //iseq3 = (message3 == vigomessage3)

                    };
                    bool result = qr_CheckService.Instance.Add_Entity(qrc);                    
                    if (result == true)
                    {
                        addcount += 1;
                        //ComLib.LogLib.Log4NetBase.Log("插入成功::" + scene_id);
                    }
                    else
                    {
                        errorCount += 1;
                        ComLib.LogLib.Log4NetBase.Log("插入失败::" + scene_id);
                    }
                    #endregion
                }
                #endregion

                ComLib.LogLib.Log4NetBase.Log("3.---------------检查Store结束！成功" + addcount + "条；失败" + errorCount + "条---------------");
            }
            catch (Exception ex)
            {
                ComLib.LogLib.Log4NetBase.Log("检查PNR错误:" + ex.Message + scene_id);
            }
        }
    }
}
